#!/user/bin/env python
# -*- coding:utf-8 -*-
#filename:controllers/tfeet/getfeet.py

'''
接收get参数，调用tfeetjson.py生成tfeet json数据返回

Created on 2011-8-25

@author: zc
'''

from checkkey import checkkey
import gettfeetjson
import web
import os
from controllers.utils import logger
logger = logger.logger()

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'

class getfeet():
    '''  all self fav
        http://tinyfeet.us/i/getfeet/all?uid=0&tfid=0&since_id=0
        http://tinyfeet.us/i/getfeet/self?uid=12121&tfid=0&since_id=0
        http://tinyfeet.us/i/getfeet/fav?uid=12121&tfid=0&since_id=0
        "http://192.168.1.103:8080/i/getfeet/all?uid=0tfid=0&since_id=0".
    '''
    def GET( self, type ):
        referer = web.input( tfid = 0 )  #接收url参数
        tfeets = None
        if checkkey( web.config._session, web.ctx.env ):
            tf = gettfeetjson.tfeet_json()
            tfid = int( referer.tfid )
            uid = int( referer.uid )
            since_id = int( referer.since_id )
            tfeets = tf.tfeet_json( tfid, uid , type, since_id ) 
        else:
            tfeets = '{"msg":"203", "errmsg":"session验证未通过."}'
        
        return tfeets

